package cn.edu.buaa.rwntm;

public class Main {
    static String inputPath = "/Users/mac/Desktop/sample-data.txt";
    static int topic_num = 100;
    static int iter_num = 500;
    static double alpha = 0.1;
    static double beta = 0.1;
    static double gamma = 0.01;
    public static void main(String[] args) {
//        checkInput(args);
        String[] convertPath = PrepareInput.convertInput(inputPath, 10);
        String wordsThetaFile = RWNTM.build_RWNTM(convertPath[1], topic_num, iter_num, alpha, beta, gamma, 1);
        InferenceTopicsForOrgDocs.convertResult(convertPath[0], wordsThetaFile, inputPath);
    }

    private static boolean checkInput(String[] args){
        if(args.length != 6){
            printHelp();
        }
        try{
            inputPath = args[0];
            topic_num = Integer.parseInt(args[1]);
            iter_num = Integer.parseInt(args[2]);
            alpha = Double.parseDouble(args[3]);
            beta = Double.parseDouble(args[4]);
            gamma = Double.parseDouble(args[5]);

            return true;
        }catch (Exception ex){
            printHelp();
            return false;
        }

    }

    private static void printHelp(){
        System.out.println("Input paramters contains error!");
        System.out.println("The basic usage is below:");
        System.out.println("java RWNTM [data_path] [topic_num] [alpha] [beta] [gamma] [iter_num]");
    }

}
